Steps for installing Postgresql

Modified from http://wiki.postgresql.org/wiki/Working_with_Eclipse
you can use this link to see the snapshots of the proceedings wherever applicable.

Requirements:

You can set up PostgreSQL by git clone as below

Setting up PostgreSQL with GIT

git clone -b REL_17_STABLE --single-branch https://git.postgresql.org/git/postgresql.git

Configuring PostgreSQL

Configuring VSCode for PostgreSQL Debugging

Create a launch.json file as below (change the paths to where you have set up postgresql on your machine.

For Linux

{    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "PostgreSQL Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "/home/sudarsha/Code/postgresql/install/bin/postgres",
                "args": ["--single", "-D", "/home/sudarsha/Code/postgresql/install/data", "test"],
                "stopAtEntry": false,
                "cwd": "/home/sudarsha/Code/postgresql",
                "environment": [],
                "externalConsole": true,
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        ]
    }

For MacOS

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [                {
                    "name": "Debug postgresql",
                    "type": "cppdbg",
                    "request": "launch",
                    "program": "/Users/ssudarshan/Code/postgresql/install/bin/postgres", // Path to your executable
                    "args": ["--single", "-D", "/Users/ssudarshan/Code/postgresql/install/data", "test"],
                    "stopAtEntry": false,
                    "cwd": "/Users/ssudarshan/Code/postgresql", // "${fileDirname}",
                    "environment": [],
                    "externalConsole": true, // Set to true if your program needs console input/output
                    "MIMode": "lldb"
                 
                
        }

    ]
}

Run Configurations in Eclipse:

Downloading PostgreSQL with Eclipse Using GIT

We recommend using the command line to download postgresql using git. But if you want to do it from the eclipse IDE you can do it as below.

  1. Eclipse should have git built in. If your version does not, first install git support by using Help > Install New Software).
  2. Open File => Import, select Git => Projects from Git and click Next. Select "URI" and click Next.a Now you will have to enter the repository's location as https://git.postgresql.org/git/postgresql.git
  3. Deselect all branches, then select 14 (or 14.5) Stable and proceed to clone Postgresql.
  4. After this software is downloaded, which may take a while. Finally you will come to a software import wizard. Choose New Project Wizard and click on next.
  5. Select the C/C++, Makefile Project with Existing Code and click next; you will then have to enter the code location which will be of the form "homedir/git/postgresql" (replace "homedir" with your home directory path, e.g. /home/sudarsha).
  6. Click on Finish
  7. Your project should now be ready (under the name "postgresql")
  8. Don't try building your project using eclipse yet. First run the steps for postgresql configurations before doing a make.